Requires Scripting PRO
The BluetoothCharacteristic interface represents a Bluetooth Low Energy (BLE) characteristic, which is the fundamental data unit in a BLE service. A characteristic exposes a specific piece of data and supports operations such as reading, writing, or subscribing to notifications.
uuid: stringThe universally unique identifier (UUID) of the characteristic.
"2A37" for Heart Rate Measurement) or custom vendor-defined characteristics.serviceUUID: string | nullThe UUID of the service that contains this characteristic. May be null if the service is not known or not yet discovered.
properties: BluetoothCharacteristicProperty[]An array of supported operations for this characteristic. These define how the characteristic can be interacted with (read, write, notify, etc.).
BluetoothCharacteristicProperty):| Property | Description |
|---|---|
"broadcast" |
Supports broadcasting |
"read" |
Supports reading |
"writeWithoutResponse" |
Supports writing without requiring acknowledgment |
"write" |
Supports writing with response |
"notify" |
Supports notification when value changes |
"indicate" |
Supports indication with acknowledgment |
"authenticatedSignedWrites" |
Supports authenticated signed writes |
"extendedProperties" |
Has extended properties (defined via descriptors) |
"notifyEncryptionRequired" |
Notification requires an encrypted connection |
"indicateEncryptionRequired" |
Indication requires an encrypted connection |
Example:
isNotifying: booleanIndicates whether notifications or indications are currently enabled for the characteristic.
true: Notifications or indications are activefalse: Notifications are not activevalue: Data | nullThe current value of the characteristic, as a Data object.
null if the value has not yet been read or written.peripheral.readValue(characteristic) to fetch the latest value.Although not directly present in the characteristic interface, attributes may be configured with permissions when used in a Peripheral (GATT Server) role.
BluetoothAttributePermissions (Enum)| Permission | Description |
|---|---|
"readable" |
The attribute can be read |
"writeable" |
The attribute can be written |
"readEncryptionRequired" |
Requires an encrypted connection to read |
"writeEncryptionRequired" |
Requires an encrypted connection to write |
"read")discoverCharacteristics(service) before interacting with any characteristic.properties before performing operations.subscribe() and later unsubscribe() to clean up."writeWithoutResponse" operations, use canSendWriteWithoutResponse to control flow rate.maxWriteValueLength() to ensure the data size is within limits.